﻿using ConsoleApp.Infrastructure.CanalCore;
using ConsoleApp.Infrastructure.Quartz;
using ConsoleApp.Infrastructure.TaskFramework;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System.Threading.Tasks;

namespace ConsoleApp
{
    class Program
    {
        static async Task Main(string[] args)
        {
            using var host = Host.CreateDefaultBuilder(args)
            .ConfigureLogging((hostingContext, logging) =>
            {
                //logging.AddFilter(log => log == LogLevel.Error);
            })
            .ConfigureAppConfiguration((hostContext, configApp) =>
            {
               
            }).ConfigureServices((hostContext, services) => {

                services.AddConsole(hostContext.HostingEnvironment);

                //services.AddJob();
                ////quartz后台服务
                //services.AddHostedService<QuartzHostedService>();
                //canal后台服务
                //services.AddHostedService<CanalHostedService>();
                //task后台服务
                services.AddHostedService<TaskHostedService>();
            }).Build();

            GlobalConfig.ServiceProviderRoot = host.Services;

            await host.StartAsync();

            await host.WaitForShutdownAsync();
        }
    }
}